package com.shanzhe.eshop.common.jdk;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @Author yinwei
 * @create 2021/12/22
 * @Version 1.0
 */
public class CacheThreadPoolDemo {
    public static void main(String[] args) {
         ExecutorService threadPool = Executors.newSingleThreadExecutor();
        for(int i = 0;i<10;i++){
            threadPool.execute(new Runnable() {
                @Override
                public void run() {
                    System.out.println("线程池异步执行任务..."+Thread.currentThread());
                }
            });
        }
    }
}
